module.exports = async (ctx,next)=>{

    const start = Date.now()

    // 等到所有中间件都执行完
    await next()

    const end = Date.now()

    const duration = end -start


    // 设置响应头
    ctx.set('X-Response-Time',duration +'ms')

}